﻿using System.IO;
using System.Xml.Serialization;
using Lync.Widget.Library.UserService;

namespace Lync.Widget.Library.Extensions
{
    public static class CustomExtensions
    {
         public static string Serialize(this User user)
         {
             return SerializeObject(user);

         }

         private  static string SerializeObject<T>(this T toSerialize)
         {
             var xmlSerializer = new XmlSerializer(typeof(T));
             var writer = new StringWriter();
             xmlSerializer.Serialize(writer, toSerialize);
             return writer.ToString();
         }

    }
}